package com.woniu.controller;

import com.woniu.form.SendWishForm;
import com.woniu.form.SetOffFireworksForm;
import com.woniu.service.FireworksService;
import com.woniu.vo.*;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author LXB
 * @Date 2023/12/18 21:15
 * @Description
 **/
@RestController("FireworksController")
@RequestMapping("/fireworks")
@Api(tags = "烟花")
public class FireworksController {

    @Autowired
    private FireworksService fireworksService;


    @ApiOperation(value = "燃放概况")
    @GetMapping("/setOffGeneral")
    @ApiImplicitParams({})
    @ApiResponses({
            @ApiResponse(code = 200,message = "data:数字就是xxx网友")
    })
    public Long setOffGeneral(){
        return fireworksService.setOffGeneral();
    }

    @ApiOperation(value = "燃放烟花")
    @PostMapping("/setOffFireworks")
    @ApiImplicitParams({})
    public SetOffFireworksVO setOffFireworks(@RequestBody SetOffFireworksForm form){
        return fireworksService.setOffFireworks(form);
    }

    @ApiOperation(value = "记录观看视频次数")
    @PostMapping("/recordWatchVideoNum")
    @ApiImplicitParams({})
    @ApiResponses({
            @ApiResponse(code = 200,message = "data:true是成功,flase是失败")
    })
    public boolean recordWatchVideoNum(){
        return fireworksService.recordWatchVideoNum();
    }


    @ApiOperation(value = "查询观看视频次数")
    @GetMapping("/watchVideoNum")
    @ApiImplicitParams({})
    @ApiResponses({
            @ApiResponse(code = 200,message = "data:直接返回查看视频的次数")
    })
    public String watchVideoNum(){
        return fireworksService.findWatchVideoNum();
    }

    @ApiOperation(value = "随机获取烟花")
    @GetMapping("/randomFireworks/{num}")
    @ApiImplicitParams({@ApiImplicitParam(name = "num",dataType = "Integer", paramType = "path",
            value = "想获取多少个随机烟花就传多少数字，例如要10个烟花就传10", required = true),})
    public List<FireworksConfigVO> randomFireworks(@PathVariable("num")Integer num){
        return fireworksService.randomFireworks(num);
    }

    @ApiOperation(value = "发射愿望")
    @PostMapping("/sendWish")
    @ApiImplicitParams({})
    @ApiResponses({
            @ApiResponse(code = 200,message = "data:true是成功,flase是失败")
    })
    public boolean sendWish(@RequestBody SendWishForm form){
        return fireworksService.sendWish(form);
    }


    @ApiOperation(value = "随机获取一条愿望")
    @GetMapping("/randomWish")
    @ApiImplicitParams({})
    public WishConfigVO randomWish(){
        return fireworksService.randomWish();
    }

    @ApiOperation(value = "随机获取一条祝福信息")
    @GetMapping("/randomBlessing")
    @ApiImplicitParams({})
    public BlessingConfigVO randomBlessing(){
        return fireworksService.randomBlessing();
    }

//    @ApiOperation(value = "随机100个用户的愿望")
//    @GetMapping("/randomUserWish")
//    @ApiImplicitParams({})
//    public List<UserWishVO> randomUserWish(){
//        return fireworksService.randomUserWish();
//    }

    @ApiOperation(value = "随机50个用户的愿望和50个3天内最大金额排序的红包")
    @GetMapping("/randomUserWishAndRedPacket")
    @ApiImplicitParams({})
    public UserWishAndRedPacketVO randomUserWishAndRedPacket() {
        return fireworksService.randomUserWishAndRedPacket();
    }


    @ApiOperation(value = "获取用户分享二维码")
    @GetMapping("/shareQrcode")
    @ApiImplicitParams({})
    public String shareQrcode(){
        return fireworksService.shareQrcode();
    }

}
